import type { RouteRecordRaw } from 'vue-router';
import home from '@/assets/imgs/svg/home.svg';
import user from '@/assets/imgs/svg/user.svg';
import hetong from '@/assets/imgs/svg/hetong.svg';
import code from '@/assets/imgs/svg/code.svg';
import sys from '@/assets/imgs/svg/sys.svg';

// 静态路由
export const staticRouter: RouteRecordRaw[] = [
    {
        path: '/',
        name: 'login',
        component: () => import('@/views/base-moudle/login/index.vue'),
        meta: {
            title: '登录',
            hidden: true,
        },
    },
    {
        path: '/TFA',
        name: 'TFA',
        component: () => import('@/views/base-moudle/TFA/index.vue'),
        meta: {
            title: 'TFA',
            hidden: true,
        },
    },
    {
        path: '/change-pwd',
        name: 'change-pwd',
        component: () => import('@/views/base-moudle/change-pwd/index.vue'),
        meta: {
            title: '修改密码',
            hidden: true,
        },
    },
    {
        path: '/404',
        name: '404',
        component: () => import('@/views/base-moudle/404/index.vue'),
        meta: {
            title: '不存在的页面',
            hidden: true,
        },
    },
];

// 异步路由
export const asyncRouter: RouteRecordRaw[] = [
    {
        path: '/layout',
        name: 'layout',
        component: () => import('@/views/layout/index.vue'),
        redirect: '/home',
        children: [
            {
                path: '/home',
                name: 'home',
                component: () => import('@/views/home/index.vue'),
                meta: {
                    title: '首页',
                    hidden: false,
                    icon: home,
                    path: '/home',
                },
            },
            {
                path: '/user',
                name: 'user',
                component: () => import('@/views/user/index.vue'),
                redirect: '/user-list',
                meta: {
                    title: '用户管理',
                    hidden: false,
                    icon: user,
                    path: '/user',
                },
                children: [
                    {
                        path: '/user-list',
                        name: 'user-list',
                        component: () => import('@/views/user/list.vue'),
                        meta: {
                            title: '用户列表',
                            hidden: false,
                            icon: 'House',
                            path: '/user-list',
                        },
                    },
                    {
                        path: '/user-detail',
                        name: 'user-detail',
                        component: () => import('@/views/user/detail.vue'),
                        meta: {
                            title: '用户详情',
                            hidden: true,
                            icon: 'House',
                            path: '/user-list',
                            breadcrumb: [
                                {
                                    path: '/home',
                                    meta: {
                                        title: '首页',
                                    },
                                },
                                {
                                    path: '/user-list',
                                    meta: {
                                        title: '用户管理',
                                    },
                                },
                                {
                                    path: '/user-list',
                                    meta: {
                                        title: '用户列表',
                                    },
                                },
                                {
                                    path: '/user-detail',
                                    meta: {
                                        title: '用户详情',
                                    },
                                },
                            ],
                        },
                    },
                ],
            },

            {
                path: '/contract-management',
                name: 'contract-management',
                component: () => import('@/views/contract-management/index.vue'),
                redirect: '/contract-management-list',
                meta: {
                    title: '合同管理',
                    hidden: false,
                    icon: hetong,
                    path: '/contract-management',
                },
                children: [
                    {
                        path: '/contract-management-list',
                        name: 'contract-management-list',
                        component: () => import('@/views/contract-management/list.vue'),
                        meta: {
                            title: '合同列表',
                            hidden: false,
                            icon: 'House',
                            path: '/contract-management-list',
                        },
                    },
                    {
                        path: '/contract-management-detail',
                        name: 'contract-management-detail',
                        component: () => import('@/views/contract-management/detail.vue'),
                        meta: {
                            title: '合同详情',
                            hidden: true,
                            icon: 'House',
                            path: '/contract-management-list',
                             breadcrumb: [
                                {
                                    path: '/home',
                                    meta: {
                                        title: '首页',
                                    },
                                },
                                {
                                    path: '/contract-management',
                                    meta: {
                                        title: '合同管理',
                                    },
                                },
                                {
                                    path: '/contract-management-list',
                                    meta: {
                                        title: '合同列表',
                                    },
                                },
                                {
                                    path: '/contract-management-detail',
                                    meta: {
                                        title: '合同详情',
                                    },
                                },
                            ],
                        },
                    },
                ],
            },

            {
                path: '/verification-code',
                name: 'verification-code',
                component: () => import('@/views/verification-code/index.vue'),
                redirect: '/sms',
                meta: {
                    title: '验证码管理',
                    hidden: false,
                    icon: code,
                    path: '/verification-code',
                },
                children: [
                    {
                        path: '/sms',
                        name: 'sms',
                        component: () => import('@/views/verification-code/sms.vue'),
                        meta: {
                            title: '短信验证码',
                            hidden: false,
                            icon: 'House',
                            path: '/sms',
                        },
                    },
                    {
                        path: '/email',
                        name: 'email',
                        component: () => import('@/views/verification-code/email.vue'),
                        meta: {
                            title: '邮箱验证码',
                            hidden: false,
                            icon: 'House',
                            path: '/sms',
                        },
                    },
                ],
            },

            {
                path: '/system',
                name: 'system',
                component: () => import('@/views/system/index.vue'),
                redirect: '/acount',
                meta: {
                    title: '系统管理',
                    hidden: false,
                    icon: sys,
                    path: '/system',
                },
                children: [
                    {
                        path: '/acount',
                        name: 'acount',
                        component: () => import('../views/system/acount/acount.vue'),
                        meta: {
                            title: '后台账号管理',
                            hidden: false,
                            icon: 'House',
                            path: '/acount',
                        },
                    },
                    {
                        path: '/permission',
                        name: 'permission',
                        component: () => import('@/views/system/permission/permission.vue'),
                        meta: {
                            title: '权限管理',
                            hidden: false,
                            icon: 'House',
                            path: '/permission',
                        },
                    },

                    {
                        path: '/country',
                        name: 'country',
                        component: () => import('../views/system/country/country.vue'),
                        meta: {
                            title: '国家管理',
                            hidden: false,
                            icon: 'House',
                            path: '/country',
                        },
                    },
                ],
            },
        ],
    },
];

// 任意路由
export const anyRouter: RouteRecordRaw[] = [
    {
        path: '/:pathMatch(.*)*',
        redirect: '/404',
        name: 'any',
        meta: {
            title: '任意路由',
            hidden: true,
        },
    },
];
